<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>列表</title>
		<link rel="stylesheet"  href="${basePath}css/styles.css"/>
		<link rel="stylesheet"  href="${basePath}css/font-awesome-4.7.0/css/font-awesome.min.css"/>
		<script  src="${basePath}js/jquery-3.6.0.js" type="text/javascript"></script>
	</head>

	<body>
	<form action="${basePath}caozuoyuan?method=list" method="post">
		<div class="condition">
			账号：
			
			<input type="text" name="cid" value="${caozuoyuan.cid}">
			姓名：

			<input type="text" name="name" value="${caozuoyuan.name}">
			<button>
				<i class="fa fa-search"></i>
				查询
			</button>
			<button type="button" onclick="window.location.href='${basePath}caozuoyuan/add.jsp'">
				<i class="fa fa-plus"></i>
				新增
			</button>
		</div>
		</form>
		<form action="${basePath}caozuoyuan?method=list" id="tableList" method="post">
		<input type="hidden" name="pageno" value="${pageinfo.pageno}">
		<input type="hidden" name="cid" value="${caozuoyuan.cid}">
		<input type="hidden" name="name" value="${caozuoyuan.name}">
		<table class="tablelist">
			<thead>
			<tr><th>ID</th>
			<th>账号</th>
			<th>姓名</th>
			<th>联系方式</th>
			<th>归属</th>
			<th class = "caozuo">操作</th></tr>
			</thead>
			<c:forEach items="${pageinfo.list}" var="caozuoyuan">
			<tr ><td>${caozuoyuan.id}</td>
			<td>${caozuoyuan.cid}</td>
			<td>${caozuoyuan.name}</td>
			<td>${caozuoyuan.num}</td>
			<td>${caozuoyuan.guishu}</td>
			<td><button class="edit" type="button" onclick="window.location.href='${basePath}caozuoyuan?method=edit&id=${caozuoyuan.id}'">
				<i class="fa fa-edit"></i>
				修改
			</button>
			<button class="remove" type="button" keyword="${caozuoyuan.id}">
				<i class="fa fa-remove"></i>
				删除
			</button></td></tr>
			</c:forEach>
			</table>
			<%@include file="../fenye.jsp"%>
		</form>
	<script type="text/javascript">
			$(function(){
				$('.remove').click(function(){
					if(confirm("确定要删除吗？")){
						window.location.href="${basePath}caozuoyuan?method=delete&id="+$(this).attr("keyword");
					}
				})
			})
	</script>
	</body>

</html>
